1 <?php if(!isset($Translation)) die('No direct access allowed.'); ?>
2 <?php $current_table = 'disease_symptoms'; ?>
3 <?php
4 $cleaner = new CI_Input();
5 $cleaner->charset = datalist_db_encoding;
6 ?>
7 <script>
8 <?php echo $current_table; ?>GetChildrenRecordsList = function(command){
9 var param = {
10 ChildTable: "<?php echo $parameters['ChildTable']; ?>",
11 ChildLookupField: "<?php echo $parameters['ChildLookupField']; ?>",
12 SelectedID: "<?php echo addslashes($parameters['SelectedID']); ?>",
13 Page: <?php echo addslashes($parameters['Page']); ?>,
14 SortBy: <?php echo ($parameters['SortBy'] === false ? '""' : $parameters['SortBy']); ?>,
15 SortDirection: '<?php echo $parameters['SortDirection']; ?>',
16 AutoClose: <?php echo ($config['auto-close'] ? 'true' : 'false'); ?>
17 };
18 var panelID = "panel_<?php echo "{$parameters['ChildTable']}-{$parameters['ChildLookupField']}"; ?>";
19 var mbWidth = window.innerWidth * 0.9;
20 var mbHeight = window.innerHeight * 0.8;
21 if(mbWidth > 1000){ mbWidth = 1000; }
22 if(mbHeight > 800){ mbHeight = 800; }
23
24 switch(command.Verb){
25 case 'sort': /* order by given field index in 'SortBy' */
26 post("parent-children.php", {
27 ChildTable: param.ChildTable,
28 ChildLookupField: param.ChildLookupField,
29 SelectedID: param.SelectedID,
30 Page: param.Page,
31 SortBy: command.SortBy,
32 SortDirection: command.SortDirection,
33 Operation: 'get-records'
34 }, panelID, undefined, 'pc-loading');
35 break;
36 case 'page': /* next or previous page as provided by 'Page' */
37 if(command.Page.toLowerCase() == 'next'){ command.Page = param.Page + 1; }
38 else if(command.Page.toLowerCase() == 'previous'){ command.Page = param.Page - 1; }
39
40 if(command.Page < 1 || command.Page > <?php echo ceil($totalMatches / $config['records-per-page']); ?>){ return; }
41 post("parent-children.php", {
42 ChildTable: param.ChildTable,
43 ChildLookupField: param.ChildLookupField,
44 SelectedID: param.SelectedID,
45 Page: command.Page,
46 SortBy: param.SortBy,
47 SortDirection: param.SortDirection,
48 Operation: 'get-records'
49 }, panelID, undefined, 'pc-loading');
50 break;
51 case 'new': /* new record */
52 var url = $j('#' + param.ChildTable + '_hclink').val() + '&addNew_x=1&Embedded=1' + (param.AutoClose ? '&AutoClose=1' : '');
53 modal_window({
54 url: url,
55 close: function(){ <?php echo $current_table; ?>GetChildrenRecordsList({ Verb: 'reload' }); },
56 size: 'full',
57 title: '<?php echo addslashes("{$config['tab-label']}: {$Translation['Add New']}"); ?>'
58 });
59 break;
60 case 'open': /* opens the detail view for given child record PK provided in 'ChildID' */
61 var url = param.ChildTable + '_view.php?Embedded=1&SelectedID=' + escape(command.ChildID) + (param.AutoClose ? '&AutoClose=1' : '');
62 modal_window({
63 url: url,
64 close: function(){ <?php echo $current_table; ?>GetChildrenRecordsList({ Verb: 'reload' }); },
65 size: 'full',
66 title: '<?php echo addslashes($config['tab-label']); ?>'
67 });
68 break;
69 case 'reload': /* just a way of refreshing children, retaining sorting and pagination & without reloading the whole page */
70 post("parent-children.php", {
71 ChildTable: param.ChildTable,
72 ChildLookupField: param.ChildLookupField,
73 SelectedID: param.SelectedID,
74 Page: param.Page,
75 SortBy: param.SortBy,
76 SortDirection: param.SortDirection,
77 Operation: 'get-records'
78 }, panelID, undefined, 'pc-loading');
79 break;
80 }
81 };
82 </script>
83
84 <div class="row">
85 <div class="col-xs-11 col-md-12">
86
87 <?php if($config['display-add-new']){ ?>
88 <?php if(stripos($_SERVER['HTTP_USER_AGENT'], 'msie ')){ ?>
89 <a href="<?php echo $parameters['ChildTable']; ?>_view.php?filterer_<?php echo $parameters['ChildLookupField']; ?>=<?php echo urlencode($parameters['SelectedID']); ?>&addNew_x=1" target="_viewchild" class="btn btn-success hspacer-sm vspacer-md"><i class="glyphicon glyphicon-plus-sign"></i> <?php echo html_attr($Translation['Add New']); ?></a>
90 <?php }else{ ?>
91 <a href="#" onclick="<?php echo $current_table; ?>GetChildrenRecordsList({ Verb: 'new' }); return false;" class="btn btn-success hspacer-sm vspacer-md"><i class="glyphicon glyphicon-plus-sign"></i> <?php echo html_attr($Translation['Add New']); ?></a>
92 <?php } ?>
93 <?php } ?>
94 <?php if($config['display-refresh']){ ?><a href="#" onclick="<?php echo $current_table; ?>GetChildrenRecordsList({ Verb: 'reload' }); return false;" class="btn btn-default hspacer-sm vspacer-md"><i class="glyphicon glyphicon-refresh"></i></a><?php } ?>
95
96
97 <div class="table-responsive">
98 <table class="table table-striped table-hover table-condensed table-bordered">
99 <thead>
100 <tr>
101 <?php if($config['open-detail-view-on-click']){ ?>
102 <th> </th>
103 <?php } ?>
104 <?php if(is_array($config['display-fields'])) foreach($config['display-fields'] as $fieldIndex => $fieldLabel){ ?>
105 <th
106 <?php if($config['sortable-fields'][$fieldIndex]){ ?>
107 onclick="<?php echo $current_table; ?>GetChildrenRecordsList({
108 Verb: 'sort',
109 SortBy: <?php echo $fieldIndex; ?>,
110 SortDirection: '<?php echo ($parameters['SortBy'] == $fieldIndex && $parameters['SortDirection'] == 'asc' ? 'desc' : 'asc'); ?>'
111 });"
112 style="cursor: pointer;"
113 <?php } ?>
114 class="<?php echo "{$current_table}-{$config['display-field-names'][$fieldIndex]}"; ?>">
115 <?php echo $fieldLabel; ?>
116 <?php if($parameters['SortBy'] == $fieldIndex && $parameters['SortDirection'] == 'desc'){ ?>
117 <i class="glyphicon glyphicon-sort-by-attributes-alt text-warning"></i>
118 <?php }elseif($parameters['SortBy'] == $fieldIndex && $parameters['SortDirection'] == 'asc'){ ?>
119 <i class="glyphicon glyphicon-sort-by-attributes text-warning"></i>
120 <?php } ?>
121 </th>
122 <?php } ?>
123 </tr>
124 </thead>
125 <tbody>
126 <?php if(is_array($records)) foreach($records as $pkValue => $record){ ?>
127 <tr>
128 <?php if($config['open-detail-view-on-click']){ ?>
129 <?php if(stripos($_SERVER['HTTP_USER_AGENT'], 'msie ')){ ?>
130 <td class="view-on-click"><a href="<?php echo $parameters['ChildTable']; ?>_view.php?SelectedID=<?php echo urlencode($record[$config['child-primary-key-index']]); ?>" target="_viewchild" class="btn btn-default btn-block"><i class="glyphicon glyphicon-new-window hspacer-md"></i></a></td>
131 <?php }else{ ?>
132 <td class="view-on-click"><a href="#" onclick="<?php echo $current_table; ?>GetChildrenRecordsList({ Verb: 'open', ChildID: '<?php echo html_attr($record[$config['child-primary-key-index']]); ?>'}); return false;" class="btn btn-default btn-block"><i class="glyphicon glyphicon-new-window hspacer-md"></i></a></td>
133 <?php } ?>
134 <?php } ?>
135
136 <td class="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][1]}"; ?>" id="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][1]}-" . html_attr($record[$config['child-primary-key-index']]); ?>"><?php echo $cleaner->xss_clean($record[1]); ?></td>
137 <td class="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][2]}"; ?>" id="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][2]}-" . html_attr($record[$config['child-primary-key-index']]); ?>"><?php echo $cleaner->xss_clean(nl2br($record[2])); ?></td>
138 <td class="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][3]}"; ?> text-right" id="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][3]}-" . html_attr($record[$config['child-primary-key-index']]); ?>"><?php if($record[3]){ ?><a href="link.php?t=<?php echo $parameters['ChildTable']; ?>&f=reference&i=<?php echo urlencode($record[$config['child-primary-key-index']]); ?>" target="_blank"><?php echo $cleaner->xss_clean($record[3]); ?></a><?php } ?></td>
139 </tr>
140 <?php } ?>
141 </tbody>
142 <tfoot>
143 <tr>
144 <td colspan="<?php echo (count($config['display-fields']) + ($config['open-detail-view-on-click'] ? 1 : 0)); ?>">
145 <?php if($totalMatches){ ?>
146 <?php if($config['show-page-progress']){ ?>
147 <span style="margin: 10px;">
148 <?php $firstRecord = ($parameters['Page'] - 1) * $config['records-per-page'] + 1; ?>
149 <?php echo str_replace(array('<FirstRecord>', '<LastRecord>', '<RecordCount>'), array($firstRecord, $firstRecord + count($records) - 1, $totalMatches), $Translation['records x to y of z']); ?>
150 </span>
151 <?php } ?>
152 <?php }else{ ?>
153 <span class="text-danger" style="margin: 10px;"><?php echo $Translation['No matches found!']; ?></span>
154 <?php } ?>
155 </td>
156 </tr>
157 </tfoot>
158 </table>
159 </div>
160 <?php if($totalMatches){ ?>
161 <div class="row hidden-print">
162 <div class="col-xs-12">
163 <button type="button" class="btn btn-default" onclick="<?php echo $current_table; ?>GetChildrenRecordsList({ Verb: 'page', Page: 'previous' });"><i class="glyphicon glyphicon-chevron-left"></i></button>
164 <button type="button" class="btn btn-default" onclick="<?php echo $current_table; ?>GetChildrenRecordsList({ Verb: 'page', Page: 'next' });"><i class="glyphicon glyphicon-chevron-right"></i></button>
165 </div>
166 </div>
167 <?php } ?>
168 </div>
169 <div class="col-xs-1 md-hidden lg-hidden"></div>
170 </div>
171 <script>$j(function(){ $j('img[src^="thumbnail.php?i=&"').parent().hide(); });</script>